﻿using Castle.DynamicProxy;
using Framework.Core;
using Framework.Remoting.Conventions;

namespace Framework.Remoting.Client
{
    internal class WcfInterceptorFactory : IWcfInterceptorFactory
    {
        private readonly IRequest request;
        private readonly IWcfServiceInfoFactory wcfServiceInfoFactory;

        public WcfInterceptorFactory(IRequest request, IWcfServiceInfoFactory wcfServiceInfoFactory)
        {
            this.request = request;
            this.wcfServiceInfoFactory = wcfServiceInfoFactory;
        }

        public IInterceptor Create<T>(EnvMode envMode)
        {
            return new WcfInterceptor<T>(envMode, request, wcfServiceInfoFactory);
        }
    }
}